package crm.system.dao.userdao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import crm.system.dao.userdao.UserDao;
import crm.system.entity.SysUser;

public class UserDaoImpl extends HibernateDaoSupport implements UserDao {

	@Override
	/**
	 * 用户登录
	 * @param userName
	 * @param password
	 * @return
	 */
	public SysUser login(SysUser user) {
	List<SysUser> userList= this.getHibernateTemplate().find(
				"from SysUser where usrName=? and usrPassword=?", user.getUsrName(),
				user.getUsrPassword());
		String hql="from SysUser";
	if(userList!=null&&userList.size()!=0){
		return userList.get(0);
	}else{
		return null;
	}
		
		
	}

}
